﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BuyThePeople
{
    public static class Util
    {
        public static string nvl(string s, string t)
        {
            return string.IsNullOrEmpty(s) ? t : s;
        }

        public static string nvl(string s)
        {
            return nvl(s);
        }

        public static string nvl(DateTime d, string t)
        {
            return d == null ? t : d.ToShortDateString();
        }

        public static string nvl(DateTime d, DateTime t)
        {
            return nvl(d, t.ToShortDateString());
        }

        public static string nvl(DateTime d)
        {
            return nvl(d, DateTime.Now);
        }

        public static string nvl(DateTime? d, string t)
        {
            return d == null ? t : d.Value.ToShortDateString();
        }

        public static string nvl(DateTime? d, DateTime t)
        {
            return nvl(d, t.ToShortDateString());
        }

        public static string nvl(DateTime? d)
        {
            return nvl(d, DateTime.Now);
        }
    }
}